package com.xnfh.field.viewmodel

import com.xnfh.common.bean.FieldDetailBean
import com.xnfh.common.bean.FieldJfJy
import com.xnfh.common.bean.FieldListBean
import com.xnfh.common.bean.FieldWeatherBean
import com.xnfh.framework.bean.BaseResp
import com.xnfh.framework.bean.RespStateData
import com.xnfh.network.base.BaseRepository
import com.xnfh.network.manager.ApiManager
import okhttp3.RequestBody

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2023/11/24 16:53
 * @UpdateUser: ziheng
 * @UpdateDate: 2023/11/24 16:53
 * @UpdateRemark: 更新说明
 */
class FieldViewModelRes : BaseRepository() {


    suspend fun requestField(body: RequestBody, data: RespStateData<FieldListBean>) = dealResp(
        { ApiManager.api.requestFiels(body) }, data
    )

    suspend fun requestFieldDetail(body: RequestBody, data: RespStateData<FieldDetailBean>) =
        dealResp(
            { ApiManager.api.requestFiledDetail(body) }, data
        )

    suspend fun requestWeather(lonlats: String, fieldWeather: RespStateData<FieldWeatherBean>) =
        dealResp(
            { ApiManager.api.requestFieldWeather(lonlats) }, fieldWeather
        )

    suspend fun requestFiledJwJy(lonlats: String, fieldJfJy: RespStateData<FieldJfJy>) = dealResp(
        { ApiManager.api.requestFiledJwJy(lonlats) }, fieldJfJy
    )

}